Eslint 规则忽略

2020.5.28 星期四 :15:11

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// 1. 在整个文件中取消eslint检查:
/* eslint-disable */
alert(‘foo’);

// 2. 在整个文件中禁用某一项eslint规则的检查:
/* eslint-disable no-alert */
alert(‘foo’);

// 3. 在整个文件中禁用多项eslint规则的检查:
/* eslint-disable no-alert, no-console */
alert(‘foo’);
console.log(‘bar’);

// 4. 针对某一行禁用eslint检查:
alert(‘foo’); // eslint-disable-line

// eslint-disable-next-line
alert(‘foo’);

// 5. 针对某一行的某一具体规则禁用eslint检查:
alert(‘foo’); // eslint-disable-line no-alert

// eslint-disable-next-line no-alert
alert(‘foo’);

// 6. 针对某一行禁用多项具体规则的检查:

alert(‘foo’); // eslint-disable-line no-alert, quotes, semi

// eslint-disable-next-line no-alert, quotes, semi
alert(‘foo’);

knowledge is no pay,reward is kindness
0%